<html>
<head>
<title>Documento sem t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" text="#FFFFFF">

<table width="560"  border="0" cellspacing="0" cellpadding="0">
  <!--DWLayoutTable-->
        	<tr>
        		<td width="560" height="40" valign="top" style="padding:0 0 0 10"><table width="550"  border="0" cellspacing="0" cellpadding="0" ID="Table1">
   		          <!--DWLayoutTable-->
       		
                	<tr>
                		<td><table width="550" border="0" cellspacing="0" cellpadding="0">
                        	<tr>
                        		<td valign="top" style="padding:3 0 0 0"><?
include("config.php");

$sql = mssql_query("SELECT DISTINCT 
AccountCharacter.GameIDC, 
memb_stat.ServerName, memb_stat.ServerName, 
memb_stat.IP, memb_stat.ConnectTM, 
memb_stat.DisConnectTM 
from 
Memb_stat 
join 
AccountCharacter 
on 
Memb_stat.memb___id = AccountCharacter.ID 
collate Latin1_general_CI_AS 
where Memb_stat.connectstat = 1");
?>


<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="" valign="middle" bgcolor="#000000">
<?PHP include("config.php"); ?>

<?php


require_once "sql_inject.php"; 
$bDestroy_session = TRUE; 
$url_redirect = 'index.php'; 
$sqlinject = new sql_inject('./log_file_sql.log',$bDestroy_session,$url_redirect)  ; 

$ON = "Select ConnectStat FROM MEMB_STAT WHERE memb___id='$login'";
$ON2 = mssql_query( $ON );
$ON3 = mssql_fetch_row($ON2);

$CLASS = "Select Class,Resets FROM Character WHERE Name='$name'";
$CLASS2 = mssql_query( $CLASS );
$CLASS3 = mssql_fetch_row($CLASS2);

require 'config.php';
$msconnect=mssql_connect("$dbhost","$dbuser","$dbpasswd");
$msdb=mssql_select_db("MuOnline",$msconnect);

$name = stripslashes($_POST['name']);
$login = stripslashes($_POST['login']);
$id = stripslashes($_POST['id']);
$oldpwd = stripslashes($_POST['oldpwd']);

if ($id==1) {$GameID = 1;}
elseif ($id==17) {$GameID = 17;}	
elseif ($id==33) {$GameID = 33;}
elseif ($id==48) {$GameID = 48;}
else {$GameID = 0;}

if ($GameID==1) {$IDI = "Soul Master";}
elseif ($GameID==17) {$IDI = "Blade Knight";}	
elseif ($GameID==33) {$IDI = "Muse Elf";}
elseif ($GameID==48) {$IDI = "Magic Gladiator";}
else {echo "<font color='#325784'>Erro:";}

$sql_username_check = mssql_query("SELECT memb___id FROM MEMB_INFO WHERE memb___id='$login'"); 
$username_check = mssql_num_rows($sql_username_check); 

$sql_name_check = mssql_query("SELECT Name FROM Character WHERE Name='$name' and AccountID = '$login'"); 
$name_check = mssql_num_rows($sql_name_check); 

$sql_pw_check = mssql_query("SELECT memb__pwd FROM MEMB_INFO WHERE memb__pwd='$oldpwd' and memb___id='$login'"); 
$pw_check = mssql_num_rows($sql_pw_check); 


if (empty($name) || ($username_check <= 0) || ($name_check <= 0))
{ echo "<font color='#325784'>Erro: <br>";
if (empty($name))
	echo "Coloque seu char.<br>";}

if ($username_check <= 0){ 
echo "<font color='#325784'>Seu login nao existem em nosso banco de dados.<br>"; }


if ($name_check <= 0){ 
echo "<font color='#325784'>Esse char nao existe nessa conta.<br>"; }

elseif ($ON3[0] == 1){ 
echo "<font color='#325784'>Você está conectado no jogo. Saia e tente novamente!!!<br>"; }

elseif ($GameID == 0){ 
echo "<font color='#325784'>Você digitou um número de classe invalido!!!<br>"; }

elseif ($GameID == $CLASS3[0]){ 
echo "<font color='#325784'>Você já é $IDI!!!<br>"; }

elseif ($pw_check <= 0){ 
echo "<font color='#325784'>Error: A senha esta incorreta.<br>"; }

else {
$msquery = "UPDATE dbo.Character SET Class = '$GameID'
WHERE AccountID = '$login'
AND Name = '$name'
";

$sqlinject->test($msquery); 

$msresults= mssql_query($msquery);
echo "<font color='#325784'>$name agora você é $IDI .<br>";}
?>
    <div align="left"></div></td>
  </tr>
</table></td>
                   		  </tr>
                        	</table></td>
           		  </tr>
                		<td height="1" background="image/dot.gif"></td>
           		  </tr>
                	</table>
        		</td>
   		  </tr>
        	</table>
</body>
</html>
